import Dm20151123, * as $Dm20151123 from "@alicloud/dm20151123";
import * as $OpenApi from "@alicloud/openapi-client";
import * as $Util from "@alicloud/tea-util";
import { aliAccessKeyId, aliAccessKeySecret } from "@/configs/ali";

const client = createClient();
function createClient() {
	const config = new $OpenApi.Config({
		accessKeyId: aliAccessKeyId,
		accessKeySecret: aliAccessKeySecret,
	});
	config.endpoint = "dm.aliyuncs.com";
	return new Dm20151123(config);
}
export const singleSendMailRequest = async () => {
	const request = new $Dm20151123.SingleSendMailRequest({
		accountName: "batch@yuanzhe.site",
		addressType: 0,
		replyToAddress: true,
		toAddress: "1035877660@qq.com,1329010633@qq.com",
		fromAlias: "YZ官方",
		subject: "YZ网站验证码",
		htmlBody: "<p>您好，您的验证码为 <b>123456</b> 。<p>",
		replyAddress: "1035877660@qq.com",
		replyAddressAlias: "YZ",
	});
	try {
		const data = await client.singleSendMailWithOptions(request, new $Util.RuntimeOptions({}));
		console.log(data);
	} catch (err: any) {
		console.log(err.message);
		console.log(err.data["Recommend"]);
	}
};
